<?php


namespace App\Models\Traits;


trait Recommend
{
    public function setRecommendAttribute()
    {
        if (request('recommend') == '是') {
            $this->attributes['recommend'] = true;

        }

        if (request('recommend') == '否') {
            $this->attributes['recommend'] = false;
        }

    }

//文章推荐
    public function getRecommendAttribute($value)
    {
        if ($this->attributes['recommend'] == 1) {
            return $this->attributes['recommend'] = '是';
        }
        if ($this->attributes['recommend'] == 0) {
            return $this->attributes['recommend'] = '否';
        }
    }
}
